<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>阴影</title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			
			.container {
				width: 100vw;
				height: 100vh;
				display: flex;
				align-items: center;
				justify-content: center;
			}
			
			canvas {
				width: 500px;
				height: 500px;
				border: 2px solid blue;
			}
		</style>
	</head>

	<body>
		<div class="container">
			<canvas id="canvas" width="500" height="500"></canvas>
		</div>
	</body>
	<script type="text/javascript">
		window.onload = function() {
			let oCanvas = document.getElementById('canvas');
			console.dir(oCanvas);
			let oPen = oCanvas.getContext("2d");
			//偏移方向x/y轴方向
			//shadowOffsetX/shadowOffsetY
			//阴影的颜色
			//shadowColor
			//模糊程度，越大越模糊
			//shadowBlur
			
			oPen.shadowBlur=20;
			//oPen.shadowOffsetX=5;
			//oPen.shadowOffsetY=5;
			
			//四周阴影
			oPen.shadowOffsetX=0;
			oPen.shadowOffsetY=0;
			oPen.shadowColor="red";
			
			oPen.fillStyle="aqua";
			oPen.fillRect(100,100,300,300);
			
			//文字阴影
			/*oPen.font="100px bold";
			oPen.fillText("文字阴影",80,100);
			oPen.fill();*/
			
		}
	</script>
	</body>

</html>